<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Huiyuan_add extends CI_Controller  {
	function __construct()
	 {
	  	parent::__construct();
	  	$this->load->helper('date');
		$this->load->model('TB_Huiyuan');
		$this->load->helper(array('form', 'url'));
	 }
	function index()
	{
		$datestring = "%Y-%m-%d";//- %h:%i %a
		$time = time();

//echo mdate($datestring, $time);

		if($_GET["sign"]=="add")
		{
			$Data["sign"]="huiyuan/insert";
		//	$temparr[0]=array("aa"=>(array("Title"=>"","NewsSource"=>"","OrderNum"=>"","Content"=>"")));
			$temparr[0]['ID']=0;
			$temparr[0]['hy_name']="";
			$temparr[0]['hy_sex']="";
			$temparr[0]['hy_birthday']=mdate($datestring, $time);
			$temparr[0]['hy_IDcard']="";
			$temparr[0]['hy_hukou']="";
			$temparr[0]['hy_huiyuan_no']="";
			$temparr[0]['hy_indate']=mdate($datestring, $time);
			$temparr[0]['hy_clientname']="";
			$temparr[0]['hy_duty']="";
			$temparr[0]['hy_photo']="";
			$temparr[0]['hy_meno']="";
			$Data["hyEntity"]=$temparr;
		}
		else
		{
			$Data["sign"]="Huiyuan/update";
			$this->load->model('TB_Huiyuan');
			$Data["temp"]=$this->TB_Huiyuan->GetHuiyuanByID($_GET["ID"]);
			$temparr[0]['ID']=$_GET["ID"];
			$temparr[0]['hy_name']=$Data["temp"][0]->hy_name;
			$temparr[0]['hy_sex']=$Data["temp"][0]->hy_sex;
			$temparr[0]['hy_birthday']=$Data["temp"][0]->hy_birthday;
			$temparr[0]['hy_IDcard']=$Data["temp"][0]->hy_IDcard;
			$temparr[0]['hy_hukou']=$Data["temp"][0]->hy_hukou;
			$temparr[0]['hy_huiyuan_no']=$Data["temp"][0]->hy_huiyuan_no;
			$temparr[0]['hy_indate']=$Data["temp"][0]->hy_indate;
			$temparr[0]['hy_clientname']=$Data["temp"][0]->hy_clientname;
			$temparr[0]['hy_duty']=$Data["temp"][0]->hy_duty;
			$temparr[0]['hy_photo']=$Data["temp"][0]->hy_photo;
			$temparr[0]['hy_meno']=$Data["temp"][0]->hy_meno;
			$Data["hyEntity"]=$temparr;
		}
		$this->load->view('Add_huiyuan',$Data);
	}
}